function throttle(func, delay, ctx) {
  ctx = ctx || null
  let cooldown = true
  return function() {
    if (cooldown) {
      func.apply(ctx, arguments)
      cooldown = false
      setTimeout(function() {
        cooldown = true
      }, delay)
    }
  }
}

function install(Vue) {
  Vue.prototype._throttle = throttle
}

export default {install}
